<template>
  <div class="home">
    <div class="home_ico">
      <span>附近商家</span>
      <van-icon name="shop-o" />
    </div>
    <router-link
      :to="{ name: 'storeDetail', query: { id: v.id } }"
      v-for="(v, i) in data"
      :key="i"
    >
      <div class="homes_img">
        <img :src="'https://elm.cangdu.org/img/' + v.image_path" alt="" />
        <ul class="homes_ul">
          <li class="homes_ul_one">
            <div>
              <span class="homes_ul_one_span1">品牌</span>
              <span>{{ v.name }}</span>
            </div>
            <div class="homes_bao">保证票</div>
          </li>
          <li class="homes_ul_two">
            <div>
              <van-rate
                v-model="v.rating"
                size="0.2703rem"
                gutter="0.027rem"
                color="orange"
                allow-half
              />
              <span class="homes_ul_one_span2">{{ v.rating }}</span>
              <span class="homes_ul_one_span3"
                >月售{{ v.recent_order_num }}单</span
              >
            </div>
            <div>
              <span class="homes_ul_one_span4">蜂鸟专送</span>
              <span class="homes_ul_one_span5">准时达</span>
            </div>
          </li>
          <li class="homes_ul_three">
            <div>
              <div class="homes_div_spans">
                <span>￥{{ v.float_minimum_order_amount }}起送</span>
                <span>/</span>
                <span>配送费约￥{{ v.float_delivery_fee }}</span>
              </div>
            </div>
            <div>
              <div class="homes_div_spans2">
                <span>{{ v.distance }}</span>
                <span>/</span>
                <span>{{ v.order_lead_time }}</span>
              </div>
            </div>
          </li>
        </ul>
      </div>
    </router-link>
  </div>
</template>

<script>
export default {
  name: "home",
  data() {
    return {
      data: []
    };
  },
  
  created() {
    //    this.axios({
    //   metod: "GET",
    //   url: `https://elm.cangdu.org/v1/pois?city_id=${this.$store.state.allObj.id}&keyword=${this.$store.state.searchCityVal}&type=search`,
    // }).then((response) => {
    //   this.datas = response.data
    //   console.log(this.datas);
    //   console.log(this.$store.state.searchCityVal)
    // });
  // },s
    this.axios
      .get(
        "https://elm.cangdu.org/shopping/restaurants?latitude=31.22967&longitude=121.4762"
      )
      .then(res => {
        this.data = res.data;
        console.log(this.data);
      });
  }
};
</script>

<style   >
/* 附近商家 */
.home_ico {
  color: #999999;
  font-size: 0.3361rem;
  margin-left: 0.2703rem;
}
.homes_ul {
  width: 7.5835rem;
  list-style: none;
  height: 1.7103rem;
  font-size: 0.3243rem;
  margin-left: 0.2703rem;
  padding-bottom: 0.5405rem;
  border-bottom: 0.027rem solid #f1f1f1;
}
.homes_ul li {
  display: flex;
}
.homes_img img {
  width: 1.7103rem;
  height: 1.7103rem;
}
.homes_img {
  margin: 0.4054rem 10px;
  display: flex;
}
.homes_ul_one {
  justify-content: space-between;
  margin-bottom: 0.2703rem;
}
/* 品牌 */
.homes_ul_one_span1 {
  width: 0.7754rem;
  height: 0.3784rem;
  color: #333;
  background-color: #ffd930;
  border-radius: 0.0541rem;
  font-weight: 900;
  padding: 0.027rem 2px 0px;
  margin-right: 0.1351rem;
}
/* 包正票 */
.homes_bao {
  color: #999;
  font-size: 0.3243rem;
}
/* 分数 */
.homes_ul_one_span2 {
  margin: 0rem 5px;
  color: red;
  font-size: 0.4595rem;
}
/* 月售*/
.homes_ul_one_span3 {
  color: #999999;
}
/* 蜂鸟专送 */
.homes_ul_two {
  justify-content: space-between;
  width: 7.8268rem;
}
.homes_ul_one_span4 {
  background-color: #0096e9;
  border: 0.027rem solid #68bdf2;
  margin-right: 0.0541rem;
  border-radius: 0.0811rem;
  padding: 0.0541rem;
}
.homes_ul_one_span5 {
  border: 0.027rem solid #68bdf2;
  border-radius: 0.0811rem;
  padding: 0.0541rem;
}
/* 配送 */
.homes_ul_three {
  margin-top: 0.1351rem;
}
.homes_div_spans {
  color: #666666;
  font-size: 0.3243rem;
}
.homes_div_spans span:nth-child(2),
.homes_div_spans2 span:nth-child(2) {
  margin: 0 0.0541rem;
}
/* 距离时间 */
.homes_ul_three {
  justify-content: space-between;
}
.homes_div_spans2 span:nth-child(3) {
  color: #3190e8;
}
</style>
 